import request from '@/utils/request'

let baseMapping = "/course_service/chapter/";

export default {

  //根据id查询章节信息
  getChapterById(id) {
    return request({
      url: baseMapping + `getChapterById/${id}`,
      method: 'get'
    })
  },

  //查询课程的章节信息
  getChapterInfo(courseId) {
    return request({
      url: baseMapping + `getChapterInfo/${courseId}`,
      method: 'get'
    })
  },

  //添加章节
  addChapter(chapter) {
    return request({
      url: baseMapping + `addChapter`,
      method: 'post',
      data: chapter
    })
  },

  //修改章节
  updateChapter(chapter) {
    return request({
      url: baseMapping + `updateChapter`,
      method: 'post',
      data: chapter
    })
  },

  //删除章节
  deleteChapter(id) {
    return request({
      url: baseMapping + `deleteChapter/${id}`,
      method: 'get'
    })
  }
}
